package cmpp;

import cmpp.pdu.CmppPDU;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

/**
 * Created by ddouble on 2017/7/1.
 */
public class CmppEncoder extends MessageToByteEncoder {
    @Override
    protected void encode(ChannelHandlerContext channelHandlerContext, Object o, ByteBuf byteBuf) throws Exception {
        CmppPDU pduResp = (CmppPDU) o;
        byte[] bytes = pduResp.getData().getBuffer();
        byteBuf.writeBytes(bytes);
    }
}
